#ifndef _CONTROLUI_H_
#define _CONTROLUI_H_

#include "cocos2d.h"

USING_NS_CC;

class BkgLayer;

class SpeedUpBtn : public CCSprite, public CCTargetedTouchDelegate
{
public:
	CREATE_FUNC(SpeedUpBtn);
	virtual bool init();
	virtual void onEnter();
    virtual void onExit();
	 
	virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
    virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
    virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
};

///////////////////////////////////////////////////////////////////

class SavePowerBtn : public CCSprite, public CCTargetedTouchDelegate
{
public:
	CREATE_FUNC(SavePowerBtn);
	virtual bool init();
	virtual void onEnter();
    virtual void onExit();
	 
	virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
    virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
    virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
};

///////////////////////////////////////////////////////////////////

class BombBtn : public CCSprite, public CCTargetedTouchDelegate
{
public:
	CREATE_FUNC(BombBtn);
	virtual bool init();
	virtual void onEnter();
    virtual void onExit();
	 
	virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
    virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
    virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
};
///////////////////////////////////////////////////////////////////

class CrazyBtn : public CCSprite, public CCTargetedTouchDelegate
{
public:
	CREATE_FUNC(CrazyBtn);
	virtual bool init();
	virtual void onEnter();
    virtual void onExit();
	 
	virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
    virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
    virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
};
//////////////////////////////////////////////////////

class GodBtn : public CCSprite, public CCTargetedTouchDelegate
{
public:
	CREATE_FUNC(GodBtn);
	virtual bool init();
	virtual void onEnter();
    virtual void onExit();
	 
	virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
    virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
    virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
};

//////////////////////////////////////////
class ResetBtn : public CCSprite, public CCTargetedTouchDelegate
{
public:
	CREATE_FUNC(ResetBtn);
	virtual bool init();
	virtual void onEnter();
    virtual void onExit();
	 
	virtual bool ccTouchBegan(CCTouch* touch, CCEvent* event);
    virtual void ccTouchMoved(CCTouch* touch, CCEvent* event);
    virtual void ccTouchEnded(CCTouch* touch, CCEvent* event);
};

/////////////////////////////////////////////////
class PowerBar : public CCSprite
{
public:
	PowerBar();

	CREATE_FUNC(PowerBar);
	virtual bool init();
	float    setPowerPer(int nIsAdd);
	void    setTexRc();
	float   m_fPer;
	int     m_nAdd;
};

class PowerBarCtrl : public CCLayer
{
public:
	PowerBarCtrl(BkgLayer* pBkgLayer);
	~PowerBarCtrl();

	void initBars();
	void stopSavPw();
	void startSavPw(int nAdd);
	void setPower(float dt);
	bool bombingOrGodStyle();

	PowerBar* m_pPowerBars[3];
	BkgLayer* m_pParBkgLayer;
	
	int m_nMaxBar;
	int m_nFulBar;
	int m_nCurBar;
	int m_nAdd;
};



#endif
